package by.ostrovsky.webhousingsystem.controller.userrequest;

import java.util.LinkedList;
import java.util.List;

import org.apache.log4j.Logger;

import by.ostrovsky.webhousingsystem.controller.IOperateController;
import by.ostrovsky.webhousingsystem.dao.DAOFactory;
import by.ostrovsky.webhousingsystem.dao.implementation.idao.IReadDAO;
import by.ostrovsky.webhousingsystem.exception.CommonException;
import by.ostrovsky.webhousingsystem.hibernate.entity.UserRequest;

public class GetHousingRequestController implements IOperateController<UserRequest, Boolean>{
	private static Logger logger = Logger.getLogger(GetHousingRequestController.class);
	
	@Override
	public List<UserRequest> get() {
		List<UserRequest> list = new LinkedList<UserRequest>();
		try {
			DAOFactory factory = DAOFactory.getDAOFactory(DAOFactory.MySQL);
			IReadDAO<UserRequest> dao = factory.getReadHousingRequestDAO();
			
			list.addAll(dao.readAll());
		} catch (CommonException e) {
			logger.error(e);
		}
		return list;
	}

	@Override
	public Boolean set(List<UserRequest> list) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean delete(List<UserRequest> list) throws CommonException {
		// TODO Auto-generated method stub
		return null;
	}
}
